﻿using System;
using MessagePack.Formatters;

namespace MessagePack.Resolvers
{
	// Token: 0x0200012A RID: 298
	public class ContractlessStandardResolver : IFormatterResolver
	{
		// Token: 0x06000464 RID: 1124 RVA: 0x0001390F File Offset: 0x00011D0F
		private ContractlessStandardResolver()
		{
		}

		// Token: 0x06000465 RID: 1125 RVA: 0x00013917 File Offset: 0x00011D17
		public IMessagePackFormatter<T> GetFormatter<T>()
		{
			return ContractlessStandardResolver.FormatterCache<T>.formatter;
		}

		// Token: 0x040001F0 RID: 496
		public static readonly IFormatterResolver Instance = new ContractlessStandardResolver();

		// Token: 0x040001F1 RID: 497
		private static readonly IFormatterResolver[] resolvers = new IFormatterResolver[]
		{
			StandardResolver.Instance,
			DynamicContractlessObjectResolver.Instance
		};

		// Token: 0x0200012B RID: 299
		private static class FormatterCache<T>
		{
			// Token: 0x06000467 RID: 1127 RVA: 0x00013948 File Offset: 0x00011D48
			static FormatterCache()
			{
				foreach (IFormatterResolver formatterResolver in ContractlessStandardResolver.resolvers)
				{
					IMessagePackFormatter<T> messagePackFormatter = formatterResolver.GetFormatter<T>();
					if (messagePackFormatter != null)
					{
						ContractlessStandardResolver.FormatterCache<T>.formatter = messagePackFormatter;
						return;
					}
				}
			}

			// Token: 0x040001F2 RID: 498
			public static readonly IMessagePackFormatter<T> formatter;
		}
	}
}
